package com.baweiytx.club

import android.content.Context
import android.util.Log
import cn.jpush.android.api.CustomMessage
import cn.jpush.android.api.NotificationMessage
import cn.jpush.android.service.JPushMessageReceiver

/**
 * @author ytx
 * @date 2025-09-29 13:55
 * @description
 */
class MyRecevier:JPushMessageReceiver() {
    companion object{
        const val TAG = "MyRecevier"
    }
    //透传消息：不是通知的样式
    override fun onMessage(p0: Context?, p1: CustomMessage?) {
        super.onMessage(p0, p1)
        Log.d(TAG, "onMessage:有消息到达 "+p1.toString())
    }
    //通知消息
    override fun onNotifyMessageArrived(p0: Context?, p1: NotificationMessage?) {
        super.onNotifyMessageArrived(p0, p1)
        Log.d(TAG, "onNotifyMessageArrived: 通知消息到达"+p1.toString())
    }

    override fun onNotifyMessageOpened(p0: Context?, p1: NotificationMessage?) {
        super.onNotifyMessageOpened(p0, p1)
        Log.d(TAG, "onNotifyMessageOpened: 通知打开"+p1.toString())
        //判断要跳转到哪个页面
        //p1.notificationExtras
    }

    override fun onRegister(p0: Context?, p1: String?) {
        super.onRegister(p0, p1)
        Log.d(TAG, "onRegister: 注册"+p1.toString())
    }

    override fun onConnected(p0: Context?, p1: Boolean) {
        super.onConnected(p0, p1)
        Log.d(TAG, "onConnected: 链接成功"+p1)
    }
}